// 统一管理项目中所有的请求路径和参数
import axios from "../request"

// 首页数据请求
export const GetHomeData = () => axios.get('/index/index')

// 搜索窗口数据请求
export const GetHisHotData = () => axios.get('/search/index')

// 请求搜索提示列表
// export const GetSearchTipData = (val) => axios.get('/search/helper', {
//     params: {
//         keyword: value,
//     }
// })
// 写成下面这种方式,如果有多个参数,就以对象的形式传进来
export const GetSearchTipData = (params) => axios.get('/search/helper', { params })

// 请求商品搜索
export const GetGoodsListData = (params) => axios.get('/goods/list', { params })

// 请求清除历史记录
export const ClearHistory = () => axios.post("/search/clearhistory");

// 登录请求
export const ToLogin = (params) => axios.post('/auth/loginByWeb', params)

// 请求详情页数据   /goods/detail
export const GetGoodsDetail = (params) => axios.get("/goods/detail", { params });

// 请求相关产品
export const GetGoodsRelated = (params) => axios.get("/goods/related", { params });

// 请求购物车数据
export const GetCartNum = () => axios.get("/cart/goodscount");

// 加入购物车请求
export const ToAddCart = (params) => axios.post('/cart/add', params)